package com.guojiaming.shop.service;

import com.guojiaming.shop.bean.ImageFile;
import com.guojiaming.shop.dao.ImageFileMapper;
import com.guojiaming.shop.exception.DataModifyException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @author vivo
 */
@Service
@Transactional(rollbackFor = {Exception.class})
public class ImageFileService {
    @Resource
    ImageFileMapper imageFileMapper;


    public ImageFile save(ImageFile imageFile) {
        if (imageFileMapper.saveImageFile(imageFile) <= 0) {
            throw new DataModifyException();
        }
        return imageFile;
    }
}
